package com.googlecode.publicholiday.config;

import com.googlecode.publicholiday.service.DefaultPublicHolidayService;
import com.googlecode.publicholiday.service.DefaultWorkingDayService;
import com.googlecode.publicholiday.service.PublicHolidayService;
import com.googlecode.publicholiday.service.WorkingDayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ServiceConfig {

    @Autowired
    private RepositoryConfig repositoryConfig;

    @Bean
    public WorkingDayService workingDayService() {
        return new DefaultWorkingDayService(repositoryConfig.immutablePublicHolidayRepository());
    }

    @Bean
    public PublicHolidayService publicHolidayService() {
        return new DefaultPublicHolidayService(repositoryConfig.mutablePublicHolidayRepository());
    }
}
